package com.vanke.activiti.common.response;

import com.vanke.activiti.constant.Constant;
import lombok.Data;

/**
 * 通用响应数据传输类
 * @param <T>
 */
@Data
public class ResultResponse<T> {
    private int code;
    private String msg;
    private T data;

    public ResultResponse(int code,String msg,T data){
        this.code =code;
        this.msg = msg;
        this.data = data;
    }
    public ResultResponse(){

    }

    public static ResultResponse getSucceed( Object data){

        return new ResultResponse(Constant.ACTIVITI_RESPONSE_RESULT_SUCCESS_CODE,Constant.ACTIVITI_RESPONSE_RESULT_SUCCESS_MSG,data);
    }
    public static ResultResponse getSucceed(String msg, Object data){
        return new ResultResponse(Constant.ACTIVITI_RESPONSE_RESULT_SUCCESS_CODE,msg,data);
    }
    public static ResultResponse getSucceed(int code, Object data){
        return new ResultResponse(code,Constant.ACTIVITI_RESPONSE_RESULT_SUCCESS_MSG,data);
    }
    public static ResultResponse getSucceed(int code,String msg, Object data){
        return new ResultResponse(code,msg,data);
    }
    public static ResultResponse getFailure( Object data){

        return new ResultResponse(Constant.ACTIVITI_RESPONSE_RESULT_FAILURE_CODE,Constant.ACTIVITI_RESPONSE_RESULT_FAILURE_MSG,data);
    }
    public static ResultResponse getFailure(String msg, Object data){

        return new ResultResponse(Constant.ACTIVITI_RESPONSE_RESULT_FAILURE_CODE,msg,data);
    }
    public static ResultResponse getFailure(int code, Object data){

        return new ResultResponse(code,Constant.ACTIVITI_RESPONSE_RESULT_FAILURE_MSG,data);
    }
    public static ResultResponse getFailure(int code,String msg, Object data){

        return new ResultResponse(code,msg,data);
    }

}
